import MathUtil from '@/MathUtil';
import MovementCommon from 'code/Core/Common/MovementCommon';
import UnitCommon from 'code/Core/Common/UnitCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 升龙霸
 **/
export default class WS_FlyDragonHit extends AbilityBase {
    static instance: WS_FlyDragonHit;
    constructor(id: string = 'Aslb') {
        super(id);
        WS_FlyDragonHit.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {}
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let ag = MathUtil.angleBetweenCoords(GetUnitX(source), GetUnitY(source), GetUnitX(target), GetUnitY(target));
        MovementCommon.hitFly({
            distance: 150,
            maxHeight: 400,
            time: 0.5,
            target: target,
            caster: source,
            angle: ag,
        });
        let lv = this.getAbilityLevel(source);
        let dmg = 170 * lv + UnitCommon.取攻击(source) * (0.75 + 0.25 * lv);
        DamageSystemInstance.applyAttackDamage(target, source, dmg, this.id);
        DestroyEffect(AddSpecialEffectTarget('Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl', target, 'origin'));
        StunSystemIntance.stun(target, 0.5, source);
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
